package Demo4;

public class Student implements Comparable{
    private  String name;
    private  int sid;
    private  int age;
    private  int score;

    public Student(){

    }

    public Student(String name, int sid, int age, int score) {
        this.name = name;
        this.sid = sid;
        this.age = age;
        this.score = score;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getSid() {
        return sid;
    }

    public void setSid(int sid) {
        this.sid = sid;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }

    public int compareTo(Object object) {
        Student student=(Student) object;
        int N=age-student.age;
        if (N>0){
            return 1;
        }else if (N==0){
            return 0;
        }else if (N<0){
            return -1;
        }
    return  0;
    }

    public int compareTo(Object object1, Object object2) {
        Student student1=(Student) object1;
        Student student2=(Student) object2;
        int N=student1.age-student2.age;
        if (N>0){
            return 1;
        }else if (N==0){
            return 0;
        }else if (N<0){
            return -1;
        }
        return  0;
    }
}
